using Senparc.Weixin.MP.Entities;
using System;
namespace Senparc.Weixin.MP.AppStore.Utility
{
	public static class AppUtility
	{
		public static WeixinRequestInfo GetWeixinRequestInfo(string toUserName)
		{
			WeixinRequestInfo weixinRequestInfo = new WeixinRequestInfo();
			try
			{
				string[] array = toUserName.Split(new char[]
				{
					'_'
				});
				weixinRequestInfo.WeixinId = int.Parse(array[1]);
				weixinRequestInfo.AppId = int.Parse(array[2]);
			}
			catch
			{
			}
			return weixinRequestInfo;
		}
		public static WeixinRequestInfo GetWeixinRequestInfo(this IRequestMessageBase requestMessage)
		{
			return AppUtility.GetWeixinRequestInfo(requestMessage.ToUserName);
		}
	}
}
